﻿Public Class TestTextBox
    Inherits TextBox

    Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
        If Me.Text.Length > 0 Then
            Select Case Me.Text.Length / Me.MaxLength
                Case Is > 0.8
                    Me.ForeColor = Color.Red
                Case Is > 0.6
                    Me.ForeColor = Color.Blue
                Case Else
                    Me.ForeColor = Color.Black
            End Select
        End If
        MyBase.OnTextChanged(e)
    End Sub

    Private Sub InitializeComponent()
        Me.SuspendLayout()
        '
        'TestTextBox
        '
        Me.MaxLength = 25
        Me.ResumeLayout(False)

    End Sub
End Class
